
Component({
  options: {
    styleIsolation: "apply-shared",
    addGlobalClass: true,
  },
  /**
   * 组件的属性列表
   */
  properties: {
    model: {
      type: Object,
      value: {
        // avatar:
        //   "https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLibWZaJnsQQpBNTmbrWEtNmA81pRvzTHjolyT5avbMclcAXuxhR3gfNYnf4Bz1icJqU1Bz5iamkw8LQ/132",
        // nickname: "宋平",
        // state: "pending",//pending进行中 fail失效 success成功
        // data: [
        //   { type: "success", time: "昨天 21:00", text: "该用户为树懒新注册用户，你已获得1天树懒会员奖励" },
        //   { type: "pending", time: "昨天 21:00", text: "该用户购买树懒会员，您将最多获得79 元现金奖励" },
        //   { type: "fail", time: "昨天 21:00", text: ":该用户未能购买树懒会员，已失效" },
        //   { type: "success", time: "昨天 21:00", text: "该用户购买树懒年卡，79元奖励已发放至您的微信零钱" },
        // ],
      },
    },
  },

    // //监听组件数据
    observers: {
      model() {
        let model = {...this.data.model}
        try {
          model.state = model.state.toLowerCase()
          this.setData({
            _model: model
          })
        } catch (error) {
          
        }
      }
    },
  /**
   * 组件的初始数据
   */
  data: {
    _model:{}
  },

  /**
   * 组件的方法列表
   */
  methods: {
    copyName(){
      wx.setClipboardData({
        data: this.data._model.nickname,
        success () {
          wx.showToast({
            title: '昵称已复制，可以去微信搜索好友',
            icon:'none',
            duration:1000,
          })
        }
      })
    }
  },
});
